<?php

class GetCodedriveSidebarePanel
{
    private static function Generate( $template, TemplateEngine $tmpl, $pageId )
    {
        $info = iSpringServices::GetProductInfo(Product::CODEDRIVE);
        $tmpl->define("panel", $template);
        $tmpl->set("VERSION", $info->version);
        $size =  round( ( $info->size / 1024 / 1024 ), 1 );
        $tmpl->set("SIZE", $size);
        $tmpl->parse("content", "panel");
        return $tmpl->getGenerated();
    }

    public static function GetContent( $panelInfo, TemplateEngine $tmpl, $pageId )
    {
        $cacheId = "html/_sidebar_panels/$pageId/".$panelInfo['id'];
        $content = Core::Cache()->Get($cacheId);
        if ( empty($content) )
        {
            $content = self::Generate( $panelInfo['template'], $tmpl, $pageId );
            Core::Cache()->Set($cacheId, $content);
        }
        return $content;
    }
}

?>